[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
Precedence
Operators--indeed, all expressions--have an inherent precedence; that
is, in the absence of explicit grouping (through parentheses), the
order of evaluation of an expression depends upon the precedence of
the elements involved. Operators of higher precedence are evaluated
before operators of lower precedence.
In the table below, elements on the same line have equal precedence.
The first two lines contain unary operators; that is, they take only
one argument. The remaining lines contain binary operators--they
take two arguments. Note that several symbols have both unary and
binary definitions.
---------------------------- Precedence --------------------------------
Operator Associativity
------------------------------------------------------------------------
( ) [ ] -> :: . Left to right
! ~ + - ++ -- & * (typecast) sizeof new delete Right to left
.* ->* Left to right
* / % Left to right
+ - Left to right
<< >> Left to right
< <= > >= Left to right
== != Left to right
& Left to right
^ Left to right
| Left to right
&& Left to right
|| Left to right
?: (conditional expression) Right to left
= *= /= %= += -= &= ^= |= <<= >>= Right to left
, Left to right
----------------------------------------------------------------------
Note that of these operators, . and ?: cannot be overloaded, nor
can the operators specific to C++, ::, .*, and ->* be overloaded.
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson